import Rest from '../../utils/http/rest'
import store from '../store/store'
import {ZY_HS_ID} from '../store/hs'

//获取指定文件的配置参数
function getOnlineConfig (dir) {
  let url = ``
  url = `https://www.zhiyecn.com/ndconfig/config-repo/zye/zye-h5-${dir}.json?timestamp=${new Date().getTime()}`
  return Rest.get(url).then(res => res.data)
}

// let hsId = ZY_HS_ID;
// if (store && store.getters.hsId) {
//   hsId = store.getters.hsId;
// }

const getParam = () => getOnlineConfig('param')
const getPlan = () => getOnlineConfig('plan')
const getCourse = () => getOnlineConfig('course')
const getHome = (hsId, env) => getOnlineConfig('home' + hsId + env)
export default {
  getParam, getPlan, getCourse, getHome
}

